--------------------------------------------------------
-- Archivo creado  - lunes-octubre-20-2014   
--------------------------------------------------------
--------------------------------------------------------
--  DDL for Table INFO_AIRE_LUGAR
--------------------------------------------------------

  CREATE TABLE "INFO_AIRE_LUGAR" 
   (	"ID_INFO" NUMBER, 
	"ID_LUGAR" NUMBER, 
	"FECHA" VARCHAR2(20), 
	"HORA" VARCHAR2(20), 
	"MP2_5" VARCHAR2(20), 
	"MP10" VARCHAR2(20), 
	"SO2" VARCHAR2(20), 
	"NO2" VARCHAR2(20), 
	"CO" VARCHAR2(20), 
	"O3" VARCHAR2(20)
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
REM INSERTING into INFO_AIRE_LUGAR
SET DEFINE OFF;
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874009','23','2014-10-10','19:00','9','37',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874010','23','2014-10-10','20:00','9','37',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874011','23','2014-10-10','21:00','10','38',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874012','23','2014-10-10','22:00','11','40.5',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874013','23','2014-10-10','23:00','12','41',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874014','23','2014-10-11','01:00','16','42',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874015','23','2014-10-11','02:00','28','51',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874016','23','2014-10-11','03:00','32','53',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874017','23','2014-10-11','04:00','26','55',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874018','23','2014-10-11','05:00','33','66',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874019','23','2014-10-11','06:00','44','77',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874020','23','2014-10-11','07:00','44','84',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874021','23','2014-10-11','08:00','22','96','0.621','19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874022','23','2014-10-11','09:00','18','100.5','0.7882','19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874023','23','2014-10-11','10:00','17','90','0.621','19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874024','23','2014-10-11','10:00','17','90','1.621','19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874025','23','2014-10-11','12:00','10','37','0.7046','19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874026','23','2014-10-11','13:00','10','37','0.61','19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874027','23','2014-10-11','14:00','9','37',null,'19',null,'9.339');
Insert into INFO_AIRE_LUGAR (ID_INFO,ID_LUGAR,FECHA,HORA,MP2_5,MP10,SO2,NO2,CO,O3) values ('8874028','23','2014-10-11','15:00','9','37',null,'19',null,'9.339');
--------------------------------------------------------
--  DDL for Index INFO_AIRE_LUGAR_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "INFO_AIRE_LUGAR_PK" ON "INFO_AIRE_LUGAR" ("ID_INFO") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS" ;
--------------------------------------------------------
--  Constraints for Table INFO_AIRE_LUGAR
--------------------------------------------------------

  ALTER TABLE "INFO_AIRE_LUGAR" ADD CONSTRAINT "INFO_AIRE_LUGAR_PK" PRIMARY KEY ("ID_INFO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE;
  ALTER TABLE "INFO_AIRE_LUGAR" MODIFY ("HORA" NOT NULL ENABLE);
  ALTER TABLE "INFO_AIRE_LUGAR" MODIFY ("FECHA" NOT NULL ENABLE);
  ALTER TABLE "INFO_AIRE_LUGAR" MODIFY ("ID_LUGAR" NOT NULL ENABLE);
  ALTER TABLE "INFO_AIRE_LUGAR" MODIFY ("ID_INFO" NOT NULL ENABLE);
--------------------------------------------------------
--  Ref Constraints for Table INFO_AIRE_LUGAR
--------------------------------------------------------

  ALTER TABLE "INFO_AIRE_LUGAR" ADD CONSTRAINT "FK_LUGAR_CALIDAD" FOREIGN KEY ("ID_LUGAR")
	  REFERENCES "LUGARES_CALIDAD" ("ID") ENABLE;
--------------------------------------------------------
--  DDL for Trigger TRIG_INFOAIRE_SEQ
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "TRIG_INFOAIRE_SEQ" 
  BEFORE INSERT ON INFO_AIRE_LUGAR
  FOR EACH ROW
  BEGIN
    SELECT NSECUENCIA.nextval INTO :new.ID_INFO FROM dual;
  END
;
/
ALTER TRIGGER "TRIG_INFOAIRE_SEQ" ENABLE;
